package org.aeon.newsmanagersystem.service.impl;

import org.aeon.newsmanagersystem.dao.NewsUsersMapper;
import org.aeon.newsmanagersystem.pojo.NewsUsers;
import org.aeon.newsmanagersystem.service.NewsUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: MissingAeon
 * @date: 2024/3/27 17:30
 * @description:
 */
@Service
public class NewsUsersServiceImpl implements NewsUsersService {
    private final NewsUsersMapper newsUsersMapper;

    @Autowired
    public NewsUsersServiceImpl(NewsUsersMapper newsUsersMapper) {
        this.newsUsersMapper = newsUsersMapper;
    }

    @Override
    public NewsUsers login(NewsUsers user) {
        NewsUsers logined = newsUsersMapper.getByUname(user.getUname());
        if (logined != null && logined.getUpwd().equals(user.getUpwd())) {
            return logined;
        }
        return null;
    }
}
